#ifndef __ByteColor_hpp__
#define __ByteColor_hpp__

#include "Platform.hpp"

namespace ge {

//----------------------------------------------------------------------------//
// ByteColor
//----------------------------------------------------------------------------//

class ByteColor
{
 public:

     ByteColor( void )
     {
     }

     ByteColor( uint8 _r, uint8 _g, uint8 _b, uint8 _a = 0xff ) : r( _r ), g( _g ), b( _b ), a( _a )
     {
     }

     ByteColor( uint8 _rgb, uint8 _a = 0xff ) : r( _rgb ), g( _rgb ), b( _rgb ), a( _a )
     {
     }

     ByteColor( const ByteColor& _color ) : r( _color.r ), g( _color.g ), b( _color.b ), a( _color.a )
     {
     }

     ByteColor& operator = ( const ByteColor& _color ) 
     {
          return Set( _color );
     }

     ByteColor& Set( const ByteColor& _color )
     {
          r = _color.r;
          g = _color.g;
          b = _color.b;
          a = _color.a;
          return *this;
     }

     ByteColor& Set( uint8 _r, uint8 _g, uint8 _b, uint8 _a = 0xff )
     {
          r = _r;
          g = _g;
          b = _b;
          a = _a;
          return *this;
     }

     float ToFloat( uint _channel ) const
     {
          return v[_channel] * ( 1.0f/255.0f );
     }

 public:

     union
     {
          struct{ uint8 r, g, b, a; };
          uint8 v[4];
     };
};

} // namespace ge

#endif//__ByteColor_hpp__
